'use strict'
let window_config = {
    height: 600,
    width: 800
}
const { app, BrowserWindow } = require('electron');
const { platform } = require('os');
let main_window;
// ready
app.whenReady().then(() => { create_window(main_window, window_config, 'index.html') });

// 所有窗口被关闭
app.on('window-all-closed', () => {
    all_close();
})
// app 被激活时
app.on('activate', () => {
    if (window_count() === 0) createWindow()
})







function window_count() {
    return BrowserWindow.getAllWindows().length;
}
function all_close() {
    if (os_is_not_mac()) app.quit()
}
function os_is_not_mac() {
    return process.platform !== 'darwin';
}











function create_window(window_name, window_config, page) {

    window_name = new BrowserWindow(window_config);
    window_name.loadFile(page);
}
